using System.Windows.Forms;
using DevExpress.XtraBars.Helpers;
using DevExpress.XtraEditors;
using DevExpress.XtraRichEdit;


namespace WindowsApplication1
{
    public partial class Form1 : XtraForm
    {
        public Form1()
        {
            InitializeComponent();
            InitSkinGallery();
        }
        void InitSkinGallery()
        {
            SkinHelper.InitSkinGallery(rgbiSkins, true);
        }

        private void iOpen_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            openFileDialog1.Filter = "c files (*.c) | *.c| cpp files (*.cpp)|*.cpp";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                richEditControl.LoadDocument(openFileDialog1.FileName, DocumentFormat.PlainText);                               
            }
            
        }

        private void iSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            saveFileDialog1.Filter = "c files (*.c) | *.c| cpp files (*.cpp)|*.cpp";
            if(saveFileDialog1.ShowDialog()==DialogResult.OK)
            {
                richEditControl.SaveDocument(saveFileDialog1.FileName, DocumentFormat.PlainText);
            }
        }

        private void iSaveAs_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            saveFileDialog1.Filter = "c files (*.c) | *.c| cpp files (*.cpp)|*.cpp";
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                richEditControl.SaveDocument(saveFileDialog1.FileName, DocumentFormat.PlainText);
            }
        }
    }
}